*Create annual CPI statistics to deflate earnings from LEHD

global indata "/.../data"
set more off

insheet using $indata/BLS_CPI.csv, comma names clear
egen annual_cpi = rowmean(jan - dec)

*Make 2010 the base year
gen base = annual_cpi if year==2010
egen temp = max(base)
replace base = temp if base==.
drop temp
replace annual_cpi = annual_cpi/base
drop base

keep year annual_cpi
save $indata/bls_cpi, replace

